package com.designpatterns.interpreterpattern.impl;

import com.designpatterns.interpreterpattern.Expression;

//Expression接口的实现类
public class TerminalExpression implements Expression
{

	private String data;

	// 有参构造函数
	public TerminalExpression(String data)
	{
		this.data = data;
	}

	// 具体如何解释传进来的参数context
	@Override
	public boolean interpret(String context)
	{
		if (context.contains(data))
		{
			return true;
		}
		return false;
	}

}
